package com.itheima02;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class Test01 {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {

        ArrayList<Integer> list=new ArrayList<>();

        Method add = list.getClass().getDeclaredMethod("add", Object.class);

        add.invoke(list,"我怎么会");
        add.invoke(list,100);

        for (Object obj : list) {
            System.out.println(obj);

        }

    }
}
